import { HolidayOptions, businessStatusOptions } from "../options";
import { mapState, mapActions } from "vuex";
export default {
  data() {
    return {};
  },
  computed: {
    ...mapState("options", ["personList"]),
    fileds() {
      return [
        {
          key: "holidayType",
          filedType: "Select",
          layout: {
            span: 4,
          },
          itemProps: {
            prop: "holidayType",
          },
          props: {
            placeholder: "请选择请假类型",
            options: HolidayOptions,
          },
        },
        {
          key: "deptId",
          filedType: "Select",
          layout: {
            span: 4,
          },
          itemProps: {
            prop: "deptId",
          },
          props: {
            placeholder: "请选择所在部门",
            options: this.personList,
            valuesType: {
              label: "orgName",
              value: "orgId",
            },
          },
        },
        {
          key: "createBy",
          filedType: "Input",
          layout: {
            span: 4,
          },
          itemProps: {
            prop: "createBy",
          },
          props: {
            placeholder: "请输入创建人",
          },
        },
        {
          key: "time",
          filedType: "DatePicker",
          layout: { span: 6 },
          itemProps: {
            prop: "time",
          },
          props: {
            type: "daterange",
            placeholder: "请选择时间",
            rangeSeparator: "至",
            startPlaceholder: "开始日期",
            endPlaceholder: "结束日期",
            valueFormat: "yyyy-MM-dd",
          },
        },
        {
          key: "businessStatus",
          filedType: "Select",
          layout: {
            span: 4,
          },
          itemProps: {
            prop: "businessStatus",
          },
          props: {
            placeholder: "请选择状态",
            options: businessStatusOptions,
          },
        },
      ];
    },
    column() {
      return [
        {
          type: "selection",
          width: "55",
        },
        {
          type: "index",
          width: "50",
          label: "序号",
        },
        {
          prop: "holidayTypeName",
          label: "请假类型",
        },
        {
          prop: "deptName",
          label: "创建部门",
        },
        {
          prop: "createBy",
          label: "创建人",
        },
        {
          prop: "createTime",
          label: "创建日期",
        },
        {
          prop: "businessStatusName",
          label: "状态",
          isSlot: true,
        },
        {
          prop: "operate",
          label: "操作",
          isSlot: true,
        },
      ];
    },
  },
  created() {
    this.getPerson();
  },
  methods: {
    ...mapActions("options", ["getPerson"]),
  },
};
